package com.lin.mock.pay.server.model;

import lombok.Data;

/**
 * @author: linjiang
 * @date: 2024/12/13
 */
@Data
public class Result<T> {
    private Boolean success;
    private String errorCode;
    private String errorDesc;
    private T data;

    public Result(Boolean success, String errorCode, String errorDesc) {
        this(success, errorCode, errorDesc, null);
    }

    public Result(Boolean success, String errorCode, String errorDesc, T data) {
        this.success = success;
        this.errorCode = errorCode;
        this.errorDesc = errorDesc;
        this.data = data;
    }

    public static <T> Result<T> buildSuccess() {
        return new Result(Boolean.TRUE, "00000", "成功");
    }

    public static <T> Result<T> buildSuccess(T data) {
        return new Result(Boolean.TRUE, "00000", "成功", data);
    }
}
